package org.csu.mypetstore.controller;

import org.csu.mypetstore.aspect.LogAnnotation;
import org.csu.mypetstore.commonResponse.CommonResponse;
import org.csu.mypetstore.domin.Account;
import org.csu.mypetstore.domin.Category;
import org.csu.mypetstore.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/categorys")
public class CategoryController {
    @Autowired
    CategoryService categoryService;
    //查看商品
    @LogAnnotation(module="categorys",operation = "查看所有商品")
    @GetMapping("")
    public CommonResponse<List<Category>> getCategoryList(){
        return categoryService.getCategoryList();
    }
    //通过catid查看商品
    @LogAnnotation(module="categorys",operation = "通过catid查看商品")
    @GetMapping("/{categoryId}")
    public CommonResponse<Category> getCategory(@PathVariable String categoryId){
        return categoryService.getCategory(categoryId);
    }


}
